﻿using System.Text;
using System.Threading.Tasks;

namespace SwissTransTracker
{
    public static partial class Api
    {
        /// <summary>
        ///     Get's all the transports at a specified location
        /// </summary>
        /// <param name="station">the locations name</param>
        /// <returns>A list of all transports stopping there</returns>
        public static Task<Stationboard> GetStationBoard(string station)
        {
            var sb = new StringBuilder("http://transport.opendata.ch/v1/stationboard");
            sb.Append("?station=").Append(station);
            return Fetch<Stationboard>(sb.ToString());
        }

        /// <summary>
        ///     Get's all the transports at a specified location
        /// </summary>
        /// <param name="station">the locations name</param>
        /// <param name="id">The id of the station to go for</param>
        /// <returns>A list of all transports stopping there</returns>
        public static Task<Stationboard> GetStationBoard(string station, int id)
        {
            var sb = new StringBuilder("http://transport.opendata.ch/v1/stationboard");
            sb.Append("?station=").Append(station);
            sb.Append("&id=").Append(id);
            return Fetch<Stationboard>(sb.ToString());
        }

        /// <summary>
        ///     Get's all the transports at a specified location
        /// </summary>
        /// <param name="station">the locations name</param>
        /// <param name="id">The id of the station to go for</param>
        /// <param name="limit">The limit on the number of trains to return</param>
        /// <returns>A list of all transports stopping there</returns>
        public static Task<Stationboard> GetStationBoard(string station, int id, int limit)
        {
            var sb = new StringBuilder("http://transport.opendata.ch/v1/stationboard");
            sb.Append("?station=").Append(station);
            sb.Append("&id=").Append(id);
            sb.Append("&limit=").Append(limit);
            return Fetch<Stationboard>(sb.ToString());
        }
    }
}